#pragma once

#include <AP_HAL/AP_HAL_Boards.h>
#include <GCS_MAVLink/GCS_config.h>

#define AP_SIM_MAX_GPS_SENSORS 4

#ifndef AP_SIM_ADSB_ENABLED
#define AP_SIM_ADSB_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_ADSB_ENABLED

#ifndef AP_SIM_AIS_ENABLED
#define AP_SIM_AIS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_AIS_ENABLED

/*
 * Simulated proximity sensor configuration:
 */
#ifndef AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#define AP_SIM_SERIALPROXIMITYSENSOR_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_AS5600_ENABLED
#define AP_SIM_AS5600_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TFS20L_ENABLED
#define AP_SIM_TFS20L_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_PS_LIGHTWARE_ENABLED
#define AP_SIM_PS_LIGHTWARE_ENABLED AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif  // AP_SIM_PS_LIGHTWARE_ENABLED

#ifndef AP_SIM_PS_LIGHTWARE_SF45B_ENABLED
#define AP_SIM_PS_LIGHTWARE_SF45B_ENABLED AP_SIM_PS_LIGHTWARE_ENABLED
#endif  // AP_SIM_PS_LIGHTWARE_SF45B_ENABLED

#ifndef AP_SIM_PS_RPLIDARA1_ENABLED
#define AP_SIM_PS_RPLIDARA1_ENABLED AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif

#ifndef AP_SIM_PS_RPLIDARA2_ENABLED
#define AP_SIM_PS_RPLIDARA2_ENABLED AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif

#ifndef AP_SIM_PS_TERARANGERTOWER_ENABLED
#define AP_SIM_PS_TERARANGERTOWER_ENABLED AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif  // AP_SIM_PS_TERARANGERTOWER_ENABLED

#ifndef AP_SIM_PS_LD06_ENABLED
#define AP_SIM_PS_LD06_ENABLED AP_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif


#ifndef AP_SIM_CRSF_ENABLED
#define AP_SIM_CRSF_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_CRSF_ENABLED

#ifndef AP_SIM_IS31FL3195_ENABLED
#define AP_SIM_IS31FL3195_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_JEDEC_ENABLED
#define AP_SIM_JEDEC_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_JEDEC_ENABLED

#ifndef AP_SIM_JEDEC_MX25L3206E_ENABLED
#define AP_SIM_JEDEC_MX25L3206E_ENABLED AP_SIM_JEDEC_ENABLED
#endif


#ifndef AP_SIM_LED_N_ENABLED
#define AP_SIM_LED_N_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) && defined(WITH_SITL_RGBLED)
#endif

#ifndef AP_SIM_GPIO_LED_1_ENABLED
#define AP_SIM_GPIO_LED_1_ENABLED AP_SIM_LED_N_ENABLED && 0
#endif

#ifndef AP_SIM_GPIO_LED_2_ENABLED
#define AP_SIM_GPIO_LED_2_ENABLED AP_SIM_LED_N_ENABLED && 0
#endif

#ifndef AP_SIM_GPIO_LED_3_ENABLED
#define AP_SIM_GPIO_LED_3_ENABLED AP_SIM_LED_N_ENABLED && 0
#endif

#ifndef AP_SIM_GPIO_LED_RGB_ENABLED
#define AP_SIM_GPIO_LED_RGB_ENABLED AP_SIM_LED_N_ENABLED && 0
#endif

#ifndef AP_SIM_LM2755_ENABLED
#define AP_SIM_LM2755_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_LM2755_ENABLED

#ifndef AP_SIM_LP5562_ENABLED
#define AP_SIM_LP5562_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_LP5562_ENABLED

#ifndef AP_SIM_LOWEHEISER_ENABLED
#define AP_SIM_LOWEHEISER_ENABLED AP_SIM_ENABLED && HAL_MAVLINK_BINDINGS_ENABLED
#endif

#ifndef AP_SIM_SHIP_ENABLED
#define AP_SIM_SHIP_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_SLUNGPAYLOAD_ENABLED
#define AP_SIM_SLUNGPAYLOAD_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TETHER_ENABLED
#define AP_SIM_TETHER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TERARANGERI2C_ENABLED
#define AP_SIM_TERARANGERI2C_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TOSHIBALED_ENABLED
#define AP_SIM_TOSHIBALED_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_TOSHIBALED_ENABLED

#ifndef AP_SIM_TSYS03_ENABLED
#define AP_SIM_TSYS03_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_ADSB_SAGETECH_MXS_ENABLED
#define AP_SIM_ADSB_SAGETECH_MXS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_SERIALDEVICE_CORRUPTION_ENABLED
#define AP_SIM_SERIALDEVICE_CORRUPTION_ENABLED 0
#endif

#ifndef AP_SIM_GPS_ENABLED
#define AP_SIM_GPS_ENABLED AP_SIM_ENABLED
#endif

#ifndef AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#define AP_SIM_GPS_BACKEND_DEFAULT_ENABLED AP_SIM_ENABLED
#endif

#ifndef AP_SIM_GPS_FILE_ENABLED
// really need to use AP_FileSystem for this.
#define AP_SIM_GPS_FILE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX)
#endif

#ifndef AP_SIM_GPS_SBF_ENABLED
#define AP_SIM_GPS_SBF_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_TRIMBLE_ENABLED
#define AP_SIM_GPS_TRIMBLE_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_MSP_ENABLED
#define AP_SIM_GPS_MSP_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_NMEA_ENABLED
#define AP_SIM_GPS_NMEA_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_NOVA_ENABLED
#define AP_SIM_GPS_NOVA_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_SBP2_ENABLED
#define AP_SIM_GPS_SBP2_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_SBP_ENABLED
#define AP_SIM_GPS_SBP_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_GPS_UBLOX_ENABLED
#define AP_SIM_GPS_UBLOX_ENABLED AP_SIM_GPS_BACKEND_DEFAULT_ENABLED
#endif


// simulated compass support; currently only in SITL, not SimOnHW:
#ifndef AP_SIM_COMPASS_BACKEND_DEFAULT_ENABLED
#define AP_SIM_COMPASS_BACKEND_DEFAULT_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_COMPASS_QMC5883L_ENABLED
#define AP_SIM_COMPASS_QMC5883L_ENABLED AP_SIM_COMPASS_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_SIM_SOLOGIMBAL_ENABLED
#define AP_SIM_SOLOGIMBAL_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL && HAL_MAVLINK_BINDINGS_ENABLED)
#endif

#ifndef AP_SIM_GIMBAL_ENABLED
#define AP_SIM_GIMBAL_ENABLED (AP_SIM_SOLOGIMBAL_ENABLED)
#endif

#ifndef AP_SIM_AIRSPEED_DLVR_ENABLED
#define AP_SIM_AIRSPEED_DLVR_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_BATT_MONITOR_SMBUS_MAXELL_ENABLED
#define AP_SIM_BATT_MONITOR_SMBUS_MAXELL_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_BATT_MONITOR_SMBUS_ROTOYE_ENABLED
#define AP_SIM_BATT_MONITOR_SMBUS_ROTOYE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_INA3221_ENABLED
#define AP_SIM_INA3221_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_ICM40609_ENABLED
#define AP_SIM_ICM40609_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_MS5525_ENABLED
#define AP_SIM_MS5525_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_MS5611_ENABLED
#define AP_SIM_MS5611_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_MAXSONAR_I2C_XL_ENABLED
#define AP_SIM_MAXSONAR_I2C_XL_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_RF_LIGHTWAR_GRF250_ENABLED
#define AP_SIM_RF_LIGHTWAR_GRF250_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_RF_LIGHTWAREI2C_LEGACY16BIT_ENABLED
#define AP_SIM_RF_LIGHTWAREI2C_LEGACY16BIT_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_RF_BENEWAKE_TFMINIPLUS_ENABLED
#define AP_SIM_RF_BENEWAKE_TFMINIPLUS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_RF_BENEWAKE_TFMINIPLUS_ENABLED

#ifndef AP_SIM_RAMTRON_ENABLED
#define AP_SIM_RAMTRON_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_RAMTRON_ENABLED

#ifndef AP_SIM_RAMTRON_FM25V02_ENABLED
#define AP_SIM_RAMTRON_FM25V02_ENABLED AP_SIM_RAMTRON_ENABLED
#endif  // AP_SIM_RAMTRON_FM25V02_ENABLED

#ifndef AP_SIM_TEMPERATURE_MCP9600_ENABLED
#define AP_SIM_TEMPERATURE_MCP9600_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TEMPERATURE_SHT3X_ENABLED
#define AP_SIM_TEMPERATURE_SHT3X_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_TEMPERATURE_TSYS01_ENABLED
#define AP_SIM_TEMPERATURE_TSYS01_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif

#ifndef AP_SIM_VOLZ_ENABLED
#define AP_SIM_VOLZ_ENABLED AP_SIM_ENABLED
#endif  // AP_SIM_VOLZ_ENABLED

#ifndef AP_SIM_VICON_ENABLED
#define AP_SIM_VICON_ENABLED 1
#endif  // AP_SIM_VICON_ENABLED

#ifndef AP_SIM_FRAME_DEFAULT_ENABLED
#define AP_SIM_FRAME_DEFAULT_ENABLED 1
#endif

// 32-motors, a stack of 8 quadcopters:
#ifndef AP_SIM_FRAME_COPTER_DOTRIACONTA_OCTAQUAD_X_ENABLED
#define AP_SIM_FRAME_COPTER_DOTRIACONTA_OCTAQUAD_X_ENABLED AP_SIM_FRAME_DEFAULT_ENABLED
#endif

/*
 * defaults for defines gating which physics backends are supported:
 */
#ifndef AP_SIM_AIRSIM_ENABLED
#define AP_SIM_AIRSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_AIRSIM_ENABLED

#ifndef AP_SIM_CRRCSIM_ENABLED
#define AP_SIM_CRRCSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_CRRCSIM_ENABLED

#ifndef AP_SIM_FLIGHTAXIS_ENABLED
#define AP_SIM_FLIGHTAXIS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_FLIGHTAXIS_ENABLED

#ifndef AP_SIM_GAZEBO_ENABLED
#define AP_SIM_GAZEBO_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_GAZEBO_ENABLED

#ifndef AP_SIM_GLIDER_ENABLED
#define AP_SIM_GLIDER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_GLIDER_ENABLED

#ifndef AP_SIM_JSBSIM_ENABLED
#define AP_SIM_JSBSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_JSBSIM_ENABLED

#ifndef AP_SIM_JSON_ENABLED
#define AP_SIM_JSON_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_JSON_ENABLED

#ifndef AP_SIM_JSON_MASTER_ENABLED
#define AP_SIM_JSON_MASTER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_JSON_MASTER_ENABLED

#ifndef AP_SIM_LAST_LETTER_ENABLED
#define AP_SIM_LAST_LETTER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_LAST_LETTER_ENABLED

#ifndef AP_SIM_MORSE_ENABLED
#define AP_SIM_MORSE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_MORSE_ENABLED

#ifndef AP_SIM_SCRIMMAGE_ENABLED
#define AP_SIM_SCRIMMAGE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_SCRIMMAGE_ENABLED

#ifndef AP_SIM_SILENTWINGS_ENABLED
#define AP_SIM_SILENTWINGS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_SILENTWINGS_ENABLED

#ifndef AP_SIM_STRATOBLIMP_ENABLED
#define AP_SIM_STRATOBLIMP_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif // AP_SIM_STRATOBLIMP_ENABLED

#ifndef AP_SIM_WEBOTS_ENABLED
#define AP_SIM_WEBOTS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_WEBOTS_ENABLED

#ifndef AP_SIM_WEBOTSPYTHON_ENABLED
#define AP_SIM_WEBOTSPYTHON_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_WEBOTSPYTHON_ENABLED

#ifndef AP_SIM_XPLANE_ENABLED
#define AP_SIM_XPLANE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif  // AP_SIM_XPLANE_ENABLED
